<!DOCTYPE html>





<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 3.9.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/blog/images/apple-touch-icon-next.png?v=7.4.0">
  <link rel="icon" type="image/png" sizes="32x32" href="/blog/images/favicon-32x32-next.png?v=7.4.0">
  <link rel="icon" type="image/png" sizes="16x16" href="/blog/images/favicon-16x16-next.png?v=7.4.0">
  <link rel="mask-icon" href="/blog/images/logo.svg?v=7.4.0" color="#222">

<link rel="stylesheet" href="/blog/css/main.css?v=7.4.0">


<link rel="stylesheet" href="/blog/lib/font-awesome/css/font-awesome.min.css?v=4.7.0">


<script id="hexo-configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/blog/',
    scheme: 'Muse',
    version: '7.4.0',
    exturl: false,
    sidebar: {"position":"left","display":"post","offset":12,"onmobile":false},
    copycode: {"enable":false,"show_result":false,"style":null},
    back2top: {"enable":true,"sidebar":false,"scrollpercent":false},
    bookmark: {"enable":false,"color":"#222","save":"auto"},
    fancybox: false,
    mediumzoom: false,
    lazyload: false,
    pangu: false,
    algolia: {
      appID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    },
    localsearch: {"enable":true,"trigger":"auto","top_n_per_article":5,"unescape":false,"preload":false},
    path: 'public/search.xml',
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    translation: {
      copy_button: '复制',
      copy_success: '复制成功',
      copy_failure: '复制失败'
    },
    sidebarPadding: 40
  };
</script>

  <meta name="description" content="许多web应用提供大量的静态内容，主要是从磁盘中读取数据染回将数据写到套接字中，通过网络发送出去。这其中并不涉及到数据的变化。这种场景就比较适合使用零拷贝。零拷贝可以直接将数据读到内存之后，直接写到socket的channel中，减少了数据从内核态拷贝回用户态，再从用户态拷贝回内核态带来的性能损失。  正常操作从磁盘中读取数据发送出去，或者读取数据然后写到另外一个位置，不对数据本身做任何处理">
<meta name="keywords" content="Java,NIO,零拷贝">
<meta property="og:type" content="article">
<meta property="og:title" content="java中的零拷贝">
<meta property="og:url" content="http://xiejunhua.github.com/2019/09/13/zero-copy/index.html">
<meta property="og:site_name" content="Junhua&#39;s Blog">
<meta property="og:description" content="许多web应用提供大量的静态内容，主要是从磁盘中读取数据染回将数据写到套接字中，通过网络发送出去。这其中并不涉及到数据的变化。这种场景就比较适合使用零拷贝。零拷贝可以直接将数据读到内存之后，直接写到socket的channel中，减少了数据从内核态拷贝回用户态，再从用户态拷贝回内核态带来的性能损失。  正常操作从磁盘中读取数据发送出去，或者读取数据然后写到另外一个位置，不对数据本身做任何处理">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="https://tva1.sinaimg.cn/large/006y8mN6gy1g6xvjpw2m1j30kr0hv77n.jpg">
<meta property="og:image" content="https://tva1.sinaimg.cn/large/006y8mN6gy1g6ui6wu60ej311k0u0gsc.jpg">
<meta property="og:image" content="https://tva1.sinaimg.cn/large/006y8mN6gy1g6ul664o1oj30i7015dft.jpg">
<meta property="og:image" content="https://tva1.sinaimg.cn/large/006y8mN6gy1g6ul711fb9j30g001iq2z.jpg">
<meta property="og:image" content="https://tva1.sinaimg.cn/large/006y8mN6gy1g6ui9e85dej30si0imdi4.jpg">
<meta property="og:image" content="https://tva1.sinaimg.cn/large/006y8mN6gy1g6ui9tmjffj30y60ncwoh.jpg">
<meta property="og:updated_time" content="2019-09-13T06:32:54.557Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="java中的零拷贝">
<meta name="twitter:description" content="许多web应用提供大量的静态内容，主要是从磁盘中读取数据染回将数据写到套接字中，通过网络发送出去。这其中并不涉及到数据的变化。这种场景就比较适合使用零拷贝。零拷贝可以直接将数据读到内存之后，直接写到socket的channel中，减少了数据从内核态拷贝回用户态，再从用户态拷贝回内核态带来的性能损失。  正常操作从磁盘中读取数据发送出去，或者读取数据然后写到另外一个位置，不对数据本身做任何处理">
<meta name="twitter:image" content="https://tva1.sinaimg.cn/large/006y8mN6gy1g6xvjpw2m1j30kr0hv77n.jpg">
  <link rel="canonical" href="http://xiejunhua.github.com/2019/09/13/zero-copy/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome: false,
    isPost: true,
    isPage: false,
    isArchive: false
  };
</script>

  <title>java中的零拷贝 | Junhua's Blog</title>
  








  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .logo,
  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">
  <div class="container use-motion">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-meta">

    <div>
      <a href="/blog/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Junhua's Blog</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
        <p class="site-subtitle">日常工作学习记录，不定期更新</p>
      
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>


<nav class="site-nav">
  
  <ul id="menu" class="menu">
      
      
      
        
        <li class="menu-item menu-item-home">
      
    

    <a href="/blog/" rel="section"><i class="menu-item-icon fa fa-fw fa-home"></i> <br>首页</a>

  </li>
      
      
      
        
        <li class="menu-item menu-item-tags">
      
    

    <a href="/blog/tags/" rel="section"><i class="menu-item-icon fa fa-fw fa-tags"></i> <br>标签</a>

  </li>
      
      
      
        
        <li class="menu-item menu-item-categories">
      
    

    <a href="/blog/categories/" rel="section"><i class="menu-item-icon fa fa-fw fa-th"></i> <br>分类</a>

  </li>
      
      
      
        
        <li class="menu-item menu-item-archives">
      
    

    <a href="/blog/archives/" rel="section"><i class="menu-item-icon fa fa-fw fa-archive"></i> <br>归档</a>

  </li>
      <li class="menu-item menu-item-search">
        <a href="javascript:;" class="popup-trigger">
        
          <i class="menu-item-icon fa fa-search fa-fw"></i> <br>搜索</a>
      </li>
    
  </ul>

    

</nav>
  <div class="site-search">
    <div class="popup search-popup">
    <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocorrect="off" autocapitalize="none"
           placeholder="搜索..." spellcheck="false"
           type="text" id="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result"></div>

</div>
<div class="search-pop-overlay"></div>

  </div>
</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
      <article itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block post">
    <link itemprop="mainEntityOfPage" href="http://xiejunhua.github.com/blog/2019/09/13/zero-copy/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Xie.Junhua">
      <meta itemprop="description" content="简单的描述测试">
      <meta itemprop="image" content="/blog/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Junhua's Blog">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">java中的零拷贝

          
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              
                
              

              <time title="创建时间：2019-09-13 14:28:51 / 修改时间：14:32:54" itemprop="dateCreated datePublished" datetime="2019-09-13T14:28:51+08:00">2019-09-13</time>
            </span>
          
            

            
          
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/blog/categories/Java/" itemprop="url" rel="index"><span itemprop="name">Java</span></a></span>

                
                
              
            </span>
          

          
            <span class="post-meta-item" title="阅读次数">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span class="busuanzi-value" id="busuanzi_value_page_pv"></span>
            </span>
          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <blockquote>
<p>许多web应用提供大量的静态内容，主要是从磁盘中读取数据染回将数据写到套接字中，通过网络发送出去。这其中并不涉及到数据的变化。这种场景就比较适合使用零拷贝。零拷贝可以直接将数据读到内存之后，直接写到socket的channel中，减少了数据从内核态拷贝回用户态，再从用户态拷贝回内核态带来的性能损失。</p>
</blockquote>
<h4 id="正常操作"><a href="#正常操作" class="headerlink" title="正常操作"></a>正常操作</h4><p>从磁盘中读取数据发送出去，或者读取数据然后写到另外一个位置，不对数据本身做任何处理</p>
<a id="more"></a>

<p><img src="https://tva1.sinaimg.cn/large/006y8mN6gy1g6xvjpw2m1j30kr0hv77n.jpg" alt="image-20190910162724088"></p>
<p>需要进行如下几个步骤：</p>
<ol>
<li>java虚拟机通过用户空间调用底层read()请求，请求发给内核空间，这个时候会发生从用户空间模式到内核空间模式的切换。 </li>
<li>切换到内核空间模式就可以进行磁盘硬件的访问了，通过dma(直接内存访问 )技术，读取数据，并保存在内核状态的一个缓冲区中 </li>
<li>将内核空间缓冲区中的内容copy到用户空间缓冲区，这个时候就完成了读取的操作 </li>
<li>Write操作的时候，会先将数据读到用户态的缓冲区中，然后copy到内核态的缓冲区中，最后通过内核态输出到硬件 </li>
</ol>
<p>整个过程中会进行四次用户空间和内核空间的交互，还会进行两次没意义的内存拷贝，因为这里用户空间只是做为临时的数据拷贝，并没起到其他的作用。数据的交互起始都是在内核空间完成的。</p>
<h4 id="用户空间的零拷贝"><a href="#用户空间的零拷贝" class="headerlink" title="用户空间的零拷贝"></a>用户空间的零拷贝</h4><p><img src="https://tva1.sinaimg.cn/large/006y8mN6gy1g6ui6wu60ej311k0u0gsc.jpg" alt="image-20190910163049719"></p>
<p> 用户空间不必作为临时的数据中转，直接在内核空间中进行数据的复制。 用户空间不需要参与到数据的交互。如果使用内存映射的方式将数据加载到内存中，可以对数据进行修改。内存映射的方式是直接将文件映射到内核空间，所以这个时候也不会产生从用户空间到内核空间的切换。(但是在数据发送之前，还是需要在内核空间内进行数据的复制)</p>
<ol>
<li>用户空间通过sendfile()请求，切换到内核空间  </li>
<li>内核空间读取数据到内核空间缓冲区中  </li>
<li>将缓冲区中的数据写到输出目标的缓冲区中  </li>
<li>输出到硬件 </li>
</ol>
<p>代码演示</p>
<p>服务端代码</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> <span class="keyword">throws</span> Exception</span>&#123;</span><br><span class="line">    InetSocketAddress inetSocketAddress = <span class="keyword">new</span> InetSocketAddress(<span class="number">8899</span>);</span><br><span class="line">    ServerSocketChannel serverSocketChannel = ServerSocketChannel.open();</span><br><span class="line">    ServerSocket serverSocket = serverSocketChannel.socket();</span><br><span class="line">    serverSocket.setReuseAddress(<span class="keyword">true</span>);</span><br><span class="line">    serverSocket.bind(inetSocketAddress);</span><br><span class="line"></span><br><span class="line">    ByteBuffer buffer = ByteBuffer.allocate(<span class="number">4096</span>);</span><br><span class="line">    <span class="keyword">while</span> (<span class="keyword">true</span>) &#123;</span><br><span class="line">      SocketChannel socketChannel = serverSocketChannel.accept();</span><br><span class="line">      socketChannel.configureBlocking(<span class="keyword">true</span>);</span><br><span class="line">      <span class="keyword">int</span> readCount = <span class="number">0</span>;</span><br><span class="line">      <span class="keyword">while</span> (-<span class="number">1</span> != readCount) &#123;</span><br><span class="line">        <span class="keyword">try</span> &#123;</span><br><span class="line">          readCount = socketChannel.read(buffer);</span><br><span class="line">        &#125; <span class="keyword">catch</span> (Exception ex) &#123;</span><br><span class="line">          ex.printStackTrace();</span><br><span class="line">        &#125;</span><br><span class="line">        buffer.rewind();</span><br><span class="line">      &#125;</span><br><span class="line">    &#125;</span><br><span class="line">  &#125;</span><br></pre></td></tr></table></figure>

<p>老的客户端</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">OldIOClient</span> </span>&#123;</span><br><span class="line"></span><br><span class="line">  <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> <span class="keyword">throws</span> Exception</span>&#123;</span><br><span class="line">    Socket socket = <span class="keyword">new</span> Socket(<span class="string">"localhost"</span>, <span class="number">8899</span>);</span><br><span class="line">    <span class="comment">// 一个大</span></span><br><span class="line">    String fileName = <span class="string">"/Users/xiejunhua/Downloads/未命名文件夹/2019-04-08-raspbian-stretch-full.zip"</span>;</span><br><span class="line">    InputStream inputStream = <span class="keyword">new</span> FileInputStream(fileName);</span><br><span class="line">    DataOutputStream dataOutputStream = <span class="keyword">new</span> DataOutputStream(socket.getOutputStream());</span><br><span class="line"></span><br><span class="line">    <span class="keyword">byte</span>[] buffer = <span class="keyword">new</span> <span class="keyword">byte</span>[<span class="number">4096</span>];</span><br><span class="line">    <span class="keyword">long</span> readCoun;</span><br><span class="line">    <span class="keyword">long</span> total = <span class="number">0</span>;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">long</span> startTime = System.currentTimeMillis();</span><br><span class="line">    <span class="keyword">while</span> ((readCoun = inputStream.read(buffer)) &gt;= <span class="number">0</span>) &#123;</span><br><span class="line">      total += readCoun;</span><br><span class="line">      dataOutputStream.write(buffer);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    System.out.println(<span class="string">"发送总字节数: "</span> + total + <span class="string">", 耗时: "</span> + (System.currentTimeMillis() - startTime));</span><br><span class="line"></span><br><span class="line">    dataOutputStream.close();</span><br><span class="line">    socket.close();</span><br><span class="line">    inputStream.close();</span><br><span class="line">  &#125;</span><br><span class="line"></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>老的客户端代码执行时间:</p>
<p><img src="https://tva1.sinaimg.cn/large/006y8mN6gy1g6ul664o1oj30i7015dft.jpg" alt="image-20190910181257542"></p>
<p>新的客户端代码:</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">NewIOClient</span> </span>&#123;</span><br><span class="line"></span><br><span class="line">  <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> <span class="keyword">throws</span> Exception</span>&#123;</span><br><span class="line">    SocketChannel socketChannel = SocketChannel.open();</span><br><span class="line">    socketChannel.connect(<span class="keyword">new</span> InetSocketAddress(<span class="string">"localhost"</span>, <span class="number">8899</span>));</span><br><span class="line">    socketChannel.configureBlocking(<span class="keyword">true</span>);</span><br><span class="line">    String fileName = <span class="string">"/Users/xiejunhua/Downloads/未命名文件夹/2019-04-08-raspbian-stretch-full.zip"</span>;</span><br><span class="line">    FileChannel fileChannel = <span class="keyword">new</span> FileInputStream(fileName).getChannel();</span><br><span class="line">    <span class="keyword">long</span> startTime = System.currentTimeMillis();</span><br><span class="line">    <span class="comment">// 将数据之间发送到socketChannel中</span></span><br><span class="line">    <span class="keyword">long</span> transferCount = fileChannel.transferTo(<span class="number">0</span>, fileChannel.size(), socketChannel);</span><br><span class="line"></span><br><span class="line">    System.out.println(<span class="string">"发送总字节数: "</span> + transferCount + <span class="string">", 耗时: "</span> + (System.currentTimeMillis() - startTime));</span><br><span class="line">    fileChannel.close();</span><br><span class="line">  &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>新的客户端代码执行的时间:</p>
<p><img src="https://tva1.sinaimg.cn/large/006y8mN6gy1g6ul711fb9j30g001iq2z.jpg" alt="image-20190910181437005"></p>
<p>结果可以很明显的看到，使用了零拷贝的代码在效率上有很大的提升。</p>
<h4 id="真正意义上的零拷贝"><a href="#真正意义上的零拷贝" class="headerlink" title="真正意义上的零拷贝"></a>真正意义上的零拷贝</h4><p>进一步减少数据在内核空间内的拷贝和 复制</p>
<p><img src="https://tva1.sinaimg.cn/large/006y8mN6gy1g6ui9e85dej30si0imdi4.jpg" alt="3B7716C0-D96D-4ACE-84CD-9CE019EE69BB"></p>
<p><img src="https://tva1.sinaimg.cn/large/006y8mN6gy1g6ui9tmjffj30y60ncwoh.jpg" alt="A1EBD232-62F5-42F6-A70B-CDD391BC3923"></p>
<ol>
<li>文件从用户空间拷贝到内核空间</li>
<li>将拷贝到内核空间的数据的文件描述符的信息被copy到socket buffer中，而不需要拷贝整个数据。文件描述符号包含两部分信息(kernel buffer内存地址，和kernel buffer的长度)</li>
<li>协议引擎负责发送数据，从socket buffer中读取到kernel buffer的文件描述符信息，然后直接从kernel buffer中读取数据直接发送。从两个buffer中读取数据的操作就是一种gather操作</li>
</ol>

    </div>

    
    
    
        
      

      <footer class="post-footer">
          
            
          
          <div class="post-tags">
            
              <a href="/blog/tags/Java/" rel="tag"># Java</a>
            
              <a href="/blog/tags/NIO/" rel="tag"># NIO</a>
            
              <a href="/blog/tags/零拷贝/" rel="tag"># 零拷贝</a>
            
          </div>
        

        

          <div class="post-nav">
            <div class="post-nav-next post-nav-item">
              
                <a href="/blog/2019/09/09/test1/" rel="next" title="Flask应用整合uWsgi,nginx,supervisor">
                  <i class="fa fa-chevron-left"></i> Flask应用整合uWsgi,nginx,supervisor
                </a>
              
            </div>

            <span class="post-nav-divider"></span>

            <div class="post-nav-prev post-nav-item">
              
                <a href="/blog/2020/03/16/test-mult-push/" rel="prev" title="test mult push">
                  test mult push <i class="fa fa-chevron-right"></i>
                </a>
              
            </div>
          </div>
        
      </footer>
    
  </div>
  
  
  
  </article>

  </div>


          </div>
          

        </div>
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">
        
        
        
        
      

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-4"><a class="nav-link" href="#正常操作"><span class="nav-number">1.</span> <span class="nav-text">正常操作</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#用户空间的零拷贝"><span class="nav-number">2.</span> <span class="nav-text">用户空间的零拷贝</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#真正意义上的零拷贝"><span class="nav-number">3.</span> <span class="nav-text">真正意义上的零拷贝</span></a></li></ol></div>
        
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">Xie.Junhua</p>
  <div class="site-description" itemprop="description">简单的描述测试</div>
</div>
  <nav class="site-state motion-element">
      <div class="site-state-item site-state-posts">
        
          <a href="/blog/archives/">
        
          <span class="site-state-item-count">5</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
    
      
      
      <div class="site-state-item site-state-categories">
        
          
            <a href="/blog/categories/">
          
        
        <span class="site-state-item-count">2</span>
        <span class="site-state-item-name">分类</span>
        </a>
      </div>
    
      
      
      <div class="site-state-item site-state-tags">
        
          
            <a href="/blog/tags/">
          
        
        <span class="site-state-item-count">6</span>
        <span class="site-state-item-name">标签</span>
        </a>
      </div>
    
  </nav>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
      
      
        
      
      
        
      
        <a href="https://github.com/XieJunhua" title="GitHub &rarr; https://github.com/XieJunhua" rel="noopener" target="_blank"><i class="fa fa-fw fa-github"></i>GitHub</a>
      </span>
    
      <span class="links-of-author-item">
      
      
        
      
      
        
      
        <a href="mailto:xie.junhua@outlook.com" title="E-Mail &rarr; mailto:xie.junhua@outlook.com" rel="noopener" target="_blank"><i class="fa fa-fw fa-envelope"></i>E-Mail</a>
      </span>
    
  </div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2020</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Xie.Junhua</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io" class="theme-link" rel="noopener" target="_blank">Hexo</a> 强力驱动 v3.9.0</div>
  <span class="post-meta-divider">|</span>
  <div class="theme-info">主题 – <a href="https://theme-next.org" class="theme-link" rel="noopener" target="_blank">NexT.Muse</a> v7.4.0</div>

        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item-icon">
      <i class="fa fa-user"></i>
    </span>
    <span class="site-uv" title="总访客量">
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
    </span>
  
    <span class="post-meta-divider">|</span>
  
    <span class="post-meta-item-icon">
      <i class="fa fa-eye"></i>
    </span>
    <span class="site-pv" title="总访问量">
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
    </span>
  
</div>












        
      </div>
    </footer>
  </div>

  


  <script src="/blog/lib/anime.min.js?v=3.1.0"></script>
  <script src="/blog/lib/velocity/velocity.min.js?v=1.2.1"></script>
  <script src="/blog/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
<script src="/blog/js/utils.js?v=7.4.0"></script><script src="/blog/js/motion.js?v=7.4.0"></script>
<script src="/blog/js/schemes/muse.js?v=7.4.0"></script>
<script src="/blog/js/next-boot.js?v=7.4.0"></script>



  








  <script src="/blog/js/local-search.js?v=7.4.0"></script>














  

  

  

</body>
</html>
